/**
 * Created by dale on 2017/8/24.
 */
var list;
$(document).ready(function () {
    //$('title')[0].innerHTML = '客户列表';
    list = $('#List');
    $('.xh-datagrid-toolbar').parseToolbar();
    //$('.xh-form').parseForm($('#bt_Form_Add, #bt_Form_Edit'));

    xhTool.bindDocKeyDown($('#bt_list_search'));

    list.initDataGrid(modelUrl + 'plan/getPlanProgress').setSelectThenEnable(['bt_list_del']);

    var startDom    = $('#List_Search_StartTime'),
        endDom      = $('#List_Search_EndTime');

    startDom.datebox();
    endDom.datebox();

    $("#select_province").combobox({
        onSelect: function(rec){
            var areaCode = rec.value;
            $('#select_city').combobox({
                url:modelUrl+'plan/getCity?areaCode='+areaCode,
                valueField:'areaCode',
                textField:'areaName'
            });
        }

    })

    $('#bt_list_search').click(function () {
        var key=xhExtra.getValue($('#list_search'));
        var startTime=xhExtra.getValue($('#List_Search_StartTime'));
        var endTime=xhExtra.getValue($('#List_Search_EndTime'));
        var sNodeName=xhExtra.getValue($('#select_node'));
        var type=xhExtra.getValue($('#select_status'));
        var tsort=xhExtra.getValue($('#select_sort'));
        var province=$('#select_province').combobox('getText');
        var city=$('#select_city').combobox('getText');
        list.datagrid('reload',{key:key,startTime:startTime,endTime:endTime,sNodeName:sNodeName,type:type,tsort:tsort,province:province,city:city});
    });



    DataGrid.onDblClickRow= function(rowIndex, rowData){

        var $iBPPId = rowData['iBPPId'];
        console.log($iBPPId);
        window.top.xhTop.showModal({
            title:'项目流程计划',
            content:'<iframe src="'+modelUrl+'plan/planReadList?iBPPId='+$iBPPId+'" style="height: 510px;border-style: none;padding: 0px;width: 100%;"></iframe>',
            size: 'lg',
        });
        return false;
    };



});
function GetDateStr(AddDayCount) {
    var dd = new Date();
    dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
    var y = dd.getFullYear();
    var m = dd.getMonth()+1;//获取当前月份的日期
    var d = dd.getDate();
    return y+"-"+m+"-"+d;
}